import 'dart:convert';

class RepaymentBean {
  late int code;
  late String msg;
  late RepaymentPlan data;

  RepaymentBean(
      {required this.code, required this.msg, required this.data});

  // data: RepaymentPlan.fromJson(json['data']),
  factory RepaymentBean.fromJson(Map<String, dynamic> jsonMap) {
    String string = jsonMap['data'];
    Map<String, dynamic> map = json.decode(string); // 使用jsonDecode函数进行解析
    return RepaymentBean(
        code: jsonMap['code'],
        msg: jsonMap['msg'],
    data:
    (jsonMap['data'] != null ? RepaymentPlan.fromJson(map) : null)!);
  }
}

class RepaymentPlan {
  String orderNo;
  List<RepaymentList> plans;

  RepaymentPlan({required this.orderNo, required this.plans});

  factory RepaymentPlan.fromJson(Map<String, dynamic> json) {
    return RepaymentPlan(
      orderNo: json['orderNo'],
      plans: List<RepaymentList>.from(json['plans'].map((x) => RepaymentList.fromJson(x))),
    );
  }
}

class RepaymentList {
  int periodNum;
  int repayCollectionAmount;
  String repayTime;
  int reduceAmount;
  int totalPeriodNum;
  int repayFinancingConsultingAmount;
  int totalRepayAmount;
  int actualCollectionAmount;
  int actualInterestAmount;
  int actualOtherAmount;
  int repayPenaltyAmount;
  int actualTotalAmount;
  int actualPrincipalAmount;
  int repayPeriodServiceAmount;
  int repayPrincipalAmount;
  int overdueDays;
  int actualPenaltyAmount;
  int repayInterestAmount;
  int actualPeriodServiceAmount;
  int repayOtherAmount;
  int actualFinancingConsultingAmount;
  int status;

  RepaymentList({
    required this.periodNum,
    required this.repayCollectionAmount,
    required this.repayTime,
    required this.reduceAmount,
    required this.totalPeriodNum,
    required this.repayFinancingConsultingAmount,
    required this.totalRepayAmount,
    required this.actualCollectionAmount,
    required this.actualInterestAmount,
    required this.actualOtherAmount,
    required this.repayPenaltyAmount,
    required this.actualTotalAmount,
    required this.actualPrincipalAmount,
    required this.repayPeriodServiceAmount,
    required this.repayPrincipalAmount,
    required this.overdueDays,
    required this.actualPenaltyAmount,
    required this.repayInterestAmount,
    required this.actualPeriodServiceAmount,
    required this.repayOtherAmount,
    required this.actualFinancingConsultingAmount,
    required this.status,
  });

  factory RepaymentList.fromJson(Map<String, dynamic> json) {
    return RepaymentList(
      periodNum: json['periodNum'],
      repayCollectionAmount: json['repayCollectionAmount'],
      repayTime: json['repayTime'],
      reduceAmount: json['reduceAmount'],
      totalPeriodNum: json['totalPeriodNum'],
      repayFinancingConsultingAmount: json['repayFinancingConsultingAmount'],
      totalRepayAmount: json['totalRepayAmount'],
      actualCollectionAmount: json['actualCollectionAmount'],
      actualInterestAmount: json['actualInterestAmount'],
      actualOtherAmount: json['actualOtherAmount'],
      repayPenaltyAmount: json['repayPenaltyAmount'],
      actualTotalAmount: json['actualTotalAmount'],
      actualPrincipalAmount: json['actualPrincipalAmount'],
      repayPeriodServiceAmount: json['repayPeriodServiceAmount'],
      repayPrincipalAmount: json['repayPrincipalAmount'],
      overdueDays: json['overdueDays'],
      actualPenaltyAmount: json['actualPenaltyAmount'],
      repayInterestAmount: json['repayInterestAmount'],
      actualPeriodServiceAmount: json['actualPeriodServiceAmount'],
      repayOtherAmount: json['repayOtherAmount'],
      actualFinancingConsultingAmount: json['actualFinancingConsultingAmount'],
      status: json['status'],
    );
  }
}
